<?php
 Session_Start () ;
 Include ($_SESSION ["repertoire_config"]."/garennes.cfg") ;
 Include ($_SESSION ["repertoire_config"]."/init.php") ;
 Include ("../include/config.inc") ;
 verif_droits ($droit_courant, $_SESSION ["code"]) ;
 
 $tt = var_courante ("tt", 0, null) ;
 
 If (IsSet ($tt) And ($tt > 0) And ($tt <= $type_table [0][0]))
  {
   $resultats = SQL_commande ("SHOW TABLES", $id_sql) ;
   $nbr = 0 ;
   For ($i = 0 ; $i < SQL_nbr_lignes ($resultats) ; $i++)
    {
     $ligne = SQL_ligne_suivante ($resultats) ;
     $ok = SQL_commande ("ALTER TABLE ".$ligne [0]." TYPE=".$type_table [$tt][0], $id_sql) ;
     If ($ok) { $nbr++ ; }
    }
   If ($nbr == SQL_nbr_lignes ($resultats)) { $mess = 1 ; } Else { $mess = 2 ; }
  }

 $resultats = SQL_commande ("SELECT * FROM menus WHERE numero='".$droit_courant."' AND ordre='0' LIMIT 1", $id_sql) ;
 $l = SQL_tableau_associatif ($resultats, "") ; 
 Echo "<html><head>" ;
 entete_html ("Garennes", "travail", 1) ;
 Echo styles ("none", "none", "none", $l ["lien"], "none") ;
 Echo " </head>" ;
 
 Echo "<body background=\"../images/fond.png\" text=\"#000000\" OnContextMenu=\"return false\">" ;
 Echo "<center><font color=\"#0000FF\">Type&nbsp;de&nbsp;table&nbsp;MySQL</font>" ;
 If (IsSet ($mess))
  {
   Switch ($mess)
    {
     Default : Echo "&nbsp;:&nbsp;<blink><font color=\"#FF0000\">Mise&nbsp;&agrave;&nbsp;jour&nbsp;effectu&eacute;e</font></blink>" ; Break ;
     Case  2 : Echo "&nbsp;:&nbsp;<blink><font color=\"#FF0000\">La&nbsp;mise&nbsp;&agrave;&nbsp;jour&nbsp;ne&nbsp;s'est&nbsp;pas&nbsp;" ;
               Echo "effectu&eacute;e&nbsp;correctement&nbsp;:&nbsp;V&eacute;rifier&nbsp;votre&nbsp;espace&nbsp;disque&nbsp;ou" ;
	       Echo "&nbsp;version&nbsp;de&nbsp;MySQL&nbsp;!</font></blink>" ;
               Break ;
    }
  }
 Echo "</center><br>" ;
 Echo "<form action=\"./gestion_type_table.php\" method=\"post\">" ;
 Echo "<table border=\"1\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\" style=\"border:1px solid #000000;border-collapse:collapse\">" ;
 Echo "<tr><td>" ;
 Echo "<table bgcolor=\"".$l ["couleur_fond"]."\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">" ;
 Echo "<TR bgcolor=\"".$l ["lien"]."\"><td align=\"center\">&nbsp;<B>&nbsp;S&eacute;lectionner&nbsp;le&nbsp;type&nbsp;</B>&nbsp;</td></tr>" ;
 Echo "<tr><td>&nbsp;</td></tr>" ;
 Echo "<tr><td align=\"center\">&nbsp;" ;
 Echo "<select name=\"tt\">" ;
 For ($i = 1 ; $i <= $type_table [0][0] ; $i++)
  {
   Echo "<option value=\"".$i."\"" ;
   Echo ">&nbsp;".$type_table [$i][1]."&nbsp;(".$type_table [$i][0].")&nbsp;</OPTION>" ;
  }
 Echo "</select>&nbsp;" ;
 Echo "</td></tr>" ;
 Echo "<tr><td>&nbsp;</td></tr>" ;
 Echo "<tr><td align=\"center\"><input type=\"image\" src=\"../images/valider.png\" border=\"0\"></td></tr>" ;
 Echo "<tr><td>&nbsp;</td></tr>" ;
 Echo "</table>" ;
 Echo "</td></tr></table>" ;
 Echo "</body></html>" ;
?>